#1. 安装docker
apt install -y docker.io
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://hipzsnyz.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker
docker --version

#2. 安装kubeadm等k8s
apt install -y apt-transport-https
curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
EOF
apt update
apt install  kubectl=1.18.0-00 kubelet=1.18.0-00 kubeadm=1.18.0-00 -y
systemctl enable kubelet

#3. 设置iptables
iptables -t nat -A OUTPUT -d 172.24.23.137 -j DNAT --to-destination 47.103.81.142



#4. 加入前
swapoff -a

#5. 加入，使用`kubeadm token create --print-join-command`
# 此处记得使用公网
kubeadm join 172.24.23.137:6443 --token zninu8.6bntysg33o90j7bg     --discovery-token-ca-cert-hash sha256:4b83d3cb601c3c59b9935a14684da19bd6ad2fab6c5f011cd3841a8f2d1614fa




### 卸载
1. kubeadm reset -f

## 卸载flannel网络
ifconfig cni0 down
ifconfig flannel.1 down
ifconfig del flannel.1
ifconfig del cni0
ip link del flannel.1
ip link del cni0



kubeadm join 172.24.23.137:6443 --token 6miai1.p6mz0m5o5jo3o4lj     --discovery-token-ca-cert-hash sha256:bb0c5f2b1a29cb49b51a6fc0dd48c35f284ed8b8580095a8bbefe6aabd539e9d








### 加入
$ _output/bin/yurtctl join 1.2.3.4:6443 --token=zffaj3.a5vjzf09qn9ft3gt --node-type=edge-node --discovery-token-unsafe-skip-ca-verification --v=5

_output/bin/yurtctl join 47.103.81.142:6443 --token cpfyob.dfyy2iavb2y95u22 discovery-token-ca-cert-hash sha256:df15948e8206076a5a6167347b29ef4d318a07b7b83f478173c38ef7a91caf21  --node-type=edge-node --discovery-token-unsafe-skip-ca-verification  --ignore-preflight-errors=FileExisting-conntrack --v=5